diff --git a/2019/include/functions.php b/2019/include/class-UserSocialBox.php similarity index 51% copy from 2019/include/functions.php copy to 2019/include/class-UserSocialBox.php index 05c0dfa..345818b 100644 --- a/2019/include/functions.php +++ b/2019/include/class-UserSocialBox.php @@ -1,27 +1,44 @@ . /** - * Require a certain page from the template directory - * - * @param $name string page name (to be sanitized) - * @param $args mixed arguments to be passed to the page scope + * Rappresent an User Social Box */ -function template( $template_name, $template_args = [] ) { - extract( $template_args, EXTR_SKIP ); - return require CURRENT_CONFERENCE_ABSPATH . "/template/$template_name.php"; +class UserSocialBox { + + /** + * Spawn a social box + * + * @param string $user User + * @param string $social string Social title + * @param string $profile string Profile URL + * @param string $path string Icon path + * @param boolean $is_icon + */ + public static function spawn( $user, $social, $profile, $path, $is_icon = false ) { + + // call the related template + template( 'user-social-box', [ + 'user' => $user, + 'social' => $social, + 'profile' => $profile, + 'path' => $path, + 'is_icon' => $is_icon, + ] ); + } + } diff --git a/2019/include/functions.php b/2019/include/functions.php index 05c0dfa..fedead9 100644 --- a/2019/include/functions.php +++ b/2019/include/functions.php @@ -1,27 +1,42 @@ . /** * Require a certain page from the template directory * * @param $name string page name (to be sanitized) * @param $args mixed arguments to be passed to the page scope */ function template( $template_name, $template_args = [] ) { extract( $template_args, EXTR_SKIP ); return require CURRENT_CONFERENCE_ABSPATH . "/template/$template_name.php"; } + +/** + * Return a Materialize icon tag + * + * @param string $icon Icon name + * @param string $c Additional class name + */ +function icon( $icon = 'send', $c = null ) { + if( $c !== null ) { + $c = " $c"; + } else { + $c = ''; + } + return "$icon"; +} diff --git a/2019/template/user-social-box.php b/2019/template/user-social-box.php new file mode 100644 index 0000000..d8ab48d --- /dev/null +++ b/2019/template/user-social-box.php @@ -0,0 +1,50 @@ +. + +/* + * This is the template for an user social box + */ + +/* + * Args that should be passed: + * + * $user User + * $social string Social title + * $profile string Profile URL + * $path string Icon path + * $is_icon + */ + +// do not visit directly +defined( 'ABSPATH' ) or exit; +?> + +
= HTML::a( + CURRENT_CONFERENCE_PATH . "/user-edit.php?uid={$user->getUserUID()}", + __("Modifica") . icon('edit', 'left') + ) ?>
+ + += HTML::a( + $user->user_site, + __("Sito personale") . icon('contact_mail', 'right'), + null, + 'btn waves-effect purple darken-2', + 'target="_blank"' + ) ?>
+= __("Le mie skill:") ?>
+ += $skill->getSkillCode() ?>%s."), + $license->getLink() + ) ?>
+| = __("Nome") ?> | += __("Tipo") ?> | += __("Tema") ?> | += __("Dove") ?> | += __("When") ?> | +
|---|---|---|---|---|
| = HTML::a( + $event->getEventURL(), + sprintf( + "%s", + esc_html( $title = $event->getEventTitle() ) + ), + sprintf( + __("Vedi %s"), + $title + ) + ) ?> | += esc_html( $event->getChapterName() ) ?> | += esc_html( $event->getTrackName() ) ?> | +
+
+ = esc_html( $conference->getLocationName() ) ?>
+ + = esc_html( $event->getRoomName() ) ?> + |
+
+ %s (il %s)"),
+ $event->getEventStart("H:i"),
+ $event->getEventStart("d/m/Y")
+ ) ?> + = $event->getEventHumanStart() ?> + |
+
= __("Quest'anno il relatore non ha tenuto nessun talk.") ?>
+ +| = esc_html( $event->getEventTitle() ) ?> | += esc_html( $event->getConferenceTitle() ) ?> | +
+
+ = esc_html( $event->getLocationName() ) ?>
+ + |
+
+ %s (il %s)"),
+ $event->getEventStart("H:i"),
+ $event->getEventStart("d/m/Y")
+ ) ?> + = $event->getEventHumanStart() ?> + |
+